<style lang="less">
  @import './login.less';
</style>

<template>
  <div class="login">
    <div class="login-con">
      <Card icon="log-in" title="欢迎登录" :bordered="false">
        <div class="form-con">
          <login-form @on-success-valid="handleSubmit"></login-form>
          <!--<p class="login-tip">输入任意用户名和密码即可</p>-->
          <img class="qqImg" :src="connect_logo" alt="" @click="qqLogin">
          <a href="javascript:void(0)" @click="toRegisterPage" class="link" target="_blank">注册新帐号</a>
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
import LoginForm from '_c/login-form'
import { mapActions } from 'vuex'
import QC from '@/libs/qc_jssdk.js'
import connect_logo from '@/assets/images/qq/Connect_logo_3.png'
export default {
  components: {
    LoginForm
  },
  data () {
    return {
      connect_logo
    }
  },
  mounted () {
    this.logins();//需要触发的函数
  },
  methods: {
    ...mapActions([
      'handleLogin',
      'getUserInfo',
    ]),
    logins : function(){debugger
      console.info("asdf");
    },
    handleSubmit ({ userName, password }) {
      this.handleLogin({ userName, password }).then(res => {
        this.getUserInfo().then(res => {
          this.$router.push({
            name: this.$config.homeName
          })
        })
      })
    },
    toRegisterPage () {
      this.$router.push({
        name: 'register'
      })
    },
    qqLogin () {
      window.qc.Login.showPopup({
        appId: '101699027'
      })
    }
  }
}
</script>

<style>

</style>
